Skip to content

fix(updater): validate cached update filenames (v26 backport of #10115) - #10300

Merged
mmaietta merged 1 commit into
release/v26from
claude/v26-backport-10115
Oct 12, 2026
Merged

mmaietta merged 1 commit into
release/v26from
claude/v26-backport-10115

Conversation

@claude

@claude claude Bot commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

Requested via Slack thread

This backports #10115 by @OskarEichler to v26. It makes DownloadedUpdateHelper treat a cached update-info.json as corrupted, and clean the pending cache, when its fileName is missing, empty, or not a plain basename (for example ../outside.exe), so a cached update can no longer be resolved outside the pending update directory. For v26 the source change keeps the branch's named pathExists import from fs-extra, and the two new tests were ported into v26's flat downloadedUpdateHelperTest.ts layout, which imports from electron-updater/out/... and uses mkdtemp instead of the master tmpDir fixture. The original patch changeset for electron-updater is kept. Locally the updater test file passes 12/12, and the two new tests fail without the source change.

🤖 Generated with Claude Code

https://claude.ai/code/session_01BuQiaJ7WL1k8vji2pHkSHp


Generated by Claude Code

(cherry picked from commit 4ca053b)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BuQiaJ7WL1k8vji2pHkSHp
@changeset-bot

changeset-bot Bot commented Oct 11, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d7007a6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
electron-updater Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@claude
claude Bot marked this pull request as ready for review October 11, 2026 19:12

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed this PR and didn't find any bugs. Because this is a path-traversal fix in cached-update file resolution, a human look would still be worthwhile.

What was reviewed:

  • The new fileName validation (typeof === "string", non-empty, path.basename(fileName) === fileName) and its use in path.join(cacheDirForPendingUpdate, cachedFileName).
  • The new tests covering a missing fileName and a ../outside.exe traversal attempt, both rejected with cache cleanup.
  • Checked whether a literal ".." value still passes the basename check (it does, since path.basename("..") === ".."), but exploiting it also requires the cached sha512 to already match the genuine expected update hash, the same constraint the upstream fix (#10115) this backports shares.
Extended reasoning...

The diff is a 3-line security fix in packages/electron-updater/src/DownloadedUpdateHelper.ts (plus a changeset and two new vitest cases) that validates cachedInfo.fileName is a non-empty plain basename before using it in path.join, closing a path-traversal read of a corrupted/attacker-controlled update-info.json; it is a straightforward backport of an already-merged upstream PR (#10115) with added test coverage. It touches security-sensitive path-resolution logic, so per guidelines it is not auto-approved even though no bugs were found; I additionally confirmed a literal ".." value still passes the new basename check (path.basename("..") === ".."), though exploiting it would also require the cached sha512 to already equal the genuine expected hash, matching the same residual property of the original upstream fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants